package com.ahuan.resp;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Res {

    // 成功标志
    private boolean success;
    // 返回消息
    private String msg;
    // 返回数据
    private Object data;
    // 返回码
    private Integer count;

    public static Res error() {
        return new Res(false, "系统繁忙，请稍后再试",null,0);
    }

    public static Res successOperate(String msg) {
        return new Res(true, "msg", null, 0);
    }

    public static Res successOperate() {
        return new Res(true, "操作成功", null, 0);
    }

    public static Res successOperate(Object data) {
        return new Res(true, "操作成功", data, 0);
    }

    public static Res successOperate(Object data ,Integer count) {
        return new Res(true, "操作成功", data, count);
    }

    public static Res failOperate() {
        return new Res(false, "操作失败，稍后重试", null, 0);
    }
    public static Res failOperate(String msg) {
        return new Res(false,msg , null, 0);
    }
}
